﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using NL.ADA.ConfigClient.NUnit.NotificationServiceReference;
using System.ServiceModel;
using NL.ADA.NotificationService;

namespace NUnit
{
    [TestFixture]
    public class UnitTestNotificationService
    {
        private NotificationServiceClient notification;
        [Test]
        public void RegisterNotification_Test()
        {
            ImplementationCallback callBack = new ImplementationCallback();
            callBack.ServerModifiedNotify += new EventHandler<NL.ADA.Common.ServerModifiedEventArgs>(callBack_ServerModifiedNotify);
            InstanceContext context = new InstanceContext(callBack);
            notification = new NotificationServiceClient(context);
            notification.Open();
            notification.Register(1,9);
            UnitTestAdmin theAdminTest = new UnitTestAdmin();
            theAdminTest.InsertConfigViaService_Test();
        }
        [Test]
        public void UnRegisterNotification_Test()
        {
            ImplementationCallback callBack = new ImplementationCallback();
            callBack.ServerModifiedNotify += new EventHandler<NL.ADA.Common.ServerModifiedEventArgs>(callBack_ServerModifiedNotify);
            InstanceContext context = new InstanceContext(callBack);
            notification = new NotificationServiceClient(context);
            notification.Open();
            notification.UnRegister(1, 9);
            UnitTestAdmin theAdminTest = new UnitTestAdmin();
            theAdminTest.InsertConfigViaService_Test();
        }

        void callBack_ServerModifiedNotify(object sender, NL.ADA.Common.ServerModifiedEventArgs e)
        {
            Assert.That(e.Modified != null);
        }
    }
}
